package intellitrends.activities;

import intellitrends.enums.ActivityCode;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Toast;

public class IntellitrendsActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.LoadLogin();
    }
    
    @Override
    protected void onActivityResult(int requestCode,int resultCode, Intent data){
    	super.onActivityResult(requestCode, resultCode, data);

    	if ( resultCode == ActivityCode.LOGIN.getCode() ){
    		this.LoadLogin();
    	}
    	
    	if ( resultCode == ActivityCode.SIGNUP.getCode() ){
    		this.LoadSignUp();
    	}
    	
    	if ( resultCode == ActivityCode.MEMBER_PAGE.getCode() ){
    		this.LoadMembersPage();
    	}
    	
    }
    
    private void LoadLogin(){
        Intent login_intent = new Intent(getApplicationContext(),LoginActivity.class);
        startActivityForResult(login_intent, ActivityCode.LOGIN.getCode());
        
        Toast.makeText(getApplicationContext(), "Login loaded",Toast.LENGTH_SHORT).show();
    }
    
    private void LoadSignUp(){
        Intent login_intent = new Intent(getApplicationContext(),SignUpActivity.class);
        startActivityForResult(login_intent, ActivityCode.SIGNUP.getCode());
        
        Toast.makeText(getApplicationContext(), "Signup loaded",Toast.LENGTH_SHORT).show();
    }    

    private void LoadMembersPage(){
        Intent login_intent = new Intent(getApplicationContext(),MemberPageActivity.class);
        startActivityForResult(login_intent, ActivityCode.MEMBER_PAGE.getCode());
        
        Toast.makeText(getApplicationContext(), "Member Page loaded",Toast.LENGTH_SHORT).show();
    }    
}